package com.website.travle.utils;

import com.google.protobuf.Api;

public class ApiResp<T> {
    private Integer code;
    private String msg;
    private Integer count;
    private T data;

    public ApiResp successfully() {
        this.code = 0;
        this.msg = "success";
        return this;
    }

    public ApiResp(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ApiResp() {
    }

    public ApiResp(Integer code, String msg, Integer count, T data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public ApiResp failed() {
        this.code = 500;
        this.msg = "failed";
        return this;
    }

    public ApiResp failed(String msg) {
        this.msg = msg;
        this.code = 500;
        return this;
    }

}
